<template>
  <div class="collect-page">
    <van-nav-bar fixed title="我的收藏" />
     <van-list
    v-model="loading"
    :finished="finished"
    finished-text="没有更多了"
    @load="getList"
  >
    <ArticleItem v-for="item in list" :key="item.id" :item="item"></ArticleItem>
  </van-list>

  </div>
</template>

<script>
import { likeList } from '@/api/article'
export default {
  name: 'LikePage',
  data () {
    return {
      list: [],
      loading: false,
      finished: false,
      page: 0,
      pageTotal: 1
    }
  },
  methods: {
    async getList () {
      if (this.page >= this.pageTotal) {
        this.finished = true
        return
      }
      this.page++
      const result = await likeList({ page: this.page })
      this.list = [...this.list, ...result.data.data.rows]
      this.pageTotal = result.data.data.pageTotal
      this.loading = false
    }
  }
}
</script>
<style lang="less" scoped>
.collect-page {
  margin-bottom: 50px;
  margin-top: 44px;
}
</style>
